package cn.pomit.skill.groovy.web;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import cn.pomit.skill.groovy.rule.IRule;
import cn.pomit.skill.groovy.rule.RuleFactory;
import cn.pomit.skill.groovy.rule.db.RulesDao;

@RestController
@RequestMapping("/")
public class WebRest {
	@Autowired
	RulesDao rulesDao;
	
	@Resource(name = "springGroovyRule")
	IRule springGroovyRule;

	@RequestMapping(value = "/test")
	public String test() throws Exception {
		List<IRule> list = RuleFactory.getInstance(rulesDao).getRuleList();
		list.add(springGroovyRule);
		for (IRule item : list) {
			item.printInfo();
		}
		return "0000";
	}
}
